package com.itheima.dao;

import com.itheima.domian.Menu;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author althle
 * @create 08-22-9:24
 * @功能
 * @注释
 */
public interface MenuDao {

    @Select("select * from t_menu where level = 1")
    public List<Menu> findAll();

    @Select("select * from t_menu where path like concat ('/',#{path},'%')")
    public List<Menu> findMenuByParentId(String path);

    @Select("SELECT * FROM t_menu WHERE id IN(SELECT menu_id FROM t_role_menu WHERE role_id =#{id}) AND LEVEL = 1")
    public List<Menu> findMenuByRoleId(Integer id);

    @Update("update  t_user set password = #{password} where username = #{username}")
    public void changePassword (String password,String username);

}
